Skip to content

feat(ag-ui): FakeAgent for offline cockpit demo#140

Merged
blove merged 5 commits into
mainfrom
feat/ag-ui-fake-agent
Apr 30, 2026
Merged

feat(ag-ui): FakeAgent for offline cockpit demo#140
blove merged 5 commits into
mainfrom
feat/ag-ui-fake-agent

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented Apr 30, 2026

Summary

  • Adds `FakeAgent extends AbstractAgent` to `@cacheplane/ag-ui` — emits a canned streaming response (RUN_STARTED → token deltas → RUN_FINISHED) for offline demos.
  • Adds `provideFakeAgUiAgent({ tokens, delayMs })` DI convenience.
  • Wires the AG-UI cockpit demo (`cockpit/ag-ui/streaming/angular/`) to use the fake — `nx serve cockpit-ag-ui-streaming-angular` now shows a working streaming chat with no backend.
  • Adds an npm `overrides` entry to dedupe `rxjs` — `@ag-ui/client@0.0.52` pins `rxjs@7.8.1` exactly, which caused two installations and an Observable-type mismatch.

Motivation

The AG-UI dojo at `dojo.ag-ui.com` speaks CopilotKit's runtime protocol, not raw AG-UI HTTP — so an HttpAgent can't directly point at it. Until a public AG-UI-native endpoint exists (or we ship a local backend), the in-process fake unblocks the demo and proves the chat-runtime decoupling end-to-end with no external dependencies.

Real-backend swap

One line in `app.config.ts`:
```ts
providers: [provideAgUiAgent({ url: 'https://your.agent.endpoint' })]
```

Test Plan

  • `nx run-many -t lint,test,build -p chat,langgraph,ag-ui` passes
  • `nx build cockpit-ag-ui-streaming-angular` passes
  • `nx serve cockpit-ag-ui-streaming-angular` shows a streaming reply (manual)

Plan

  • `docs/superpowers/plans/2026-04-30-ag-ui-fake-agent.md`

🤖 Generated with Claude Code

blove and others added 4 commits April 30, 2026 10:57
5 tasks: implement FakeAgent + spec, provideFakeAgUiAgent + spec,
public-api exports, cockpit demo rewiring, verify + PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
In-process AbstractAgent subclass that emits a canned streaming
response. Drop-in replacement for provideAgUiAgent({ url }) when
no real backend is available. Tests cover event ordering, token
streaming, and unsubscribe cancellation.

Deviation from plan: FakeAgent.run() is public (not protected) to
satisfy AbstractAgent's public abstract signature in @ag-ui/client@0.0.53.
Spec calls agent.run() directly rather than via (agent as any).run().

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Demo runs end-to-end with no backend or network. Real-backend wiring
is one line away via provideAgUiAgent({ url: ... }).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@ag-ui/client@0.0.52 pins rxjs@7.8.1 exactly, which caused npm to
install rxjs in two locations (top-level 7.8.2 and nested 7.8.1
under node_modules/@ag-ui/client/). TypeScript saw the two Observable
types as incompatible across module boundaries when the AG-UI adapter
tried to subscribe to source.agent().

The npm override forces all rxjs resolutions to follow the project's
~7.8.0 range, deduping to a single hoisted install. ABI-compatible.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cacheplane Ready Ready Preview, Comment Apr 30, 2026 6:59pm
cacheplane-minting-service Ready Ready Preview, Comment Apr 30, 2026 6:59pm

Request Review

…ride

Previous commit (43ad74f) regenerated package-lock.json on macOS,
which silently dropped optional platform-specific @next/swc-* bindings
for non-darwin platforms. CI on Linux failed with 'Failed to load
native binding' on apps/cockpit/next.config.ts and apps/website/.

Restore main's lockfile then surgically remove only the nested
@ag-ui/client/node_modules/rxjs entry (the override target). Verified:
all 24 @next/swc-* entries present, single hoisted rxjs, npm ci passes
on clean checkout.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@blove blove merged commit 59f266f into main Apr 30, 2026
15 checks passed
@blove blove deleted the feat/ag-ui-fake-agent branch May 7, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant